//package com.ashen.boot.admin.configuration.datascope;
//
//import java.util.List;
//
//import javax.sql.DataSource;
//
//import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
//import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
//import com.ashen.boot.admin.security.model.User;
//import org.springframework.boot.autoconfigure.AutoConfigureAfter;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
//import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.method.support.HandlerMethodArgumentResolver;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
///**
// */
//@Configuration
//@ConditionalOnBean(DataSource.class)
//@AutoConfigureAfter(DataSourceAutoConfiguration.class)
//public class MybatisPlusConfiguration implements WebMvcConfigurer {
//
//    /**
//     * 增加请求参数解析器，对请求中的参数注入SQL 检查
//     * @param resolverList
//     */
//    @Override
//    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolverList) {
//        resolverList.add((HandlerMethodArgumentResolver) new SqlFilterArgumentResolver());
//    }
//
//    /**
//     * okayx 默认数据权限处理器
//     * @return OkayxDefaultDatascopeHandle
//     */
//    @Bean
//    @ConditionalOnMissingBean
//    @ConditionalOnClass(User.class)
//    public DataScopeHandle dataScopeHandle() {
//        return new UserDatascopeHandle();
//    }
//
//    /**
//     * mybatis plus 拦截器配置
//     * @return OkayxDefaultDatascopeHandle
//     */
//    @Bean
//    public MybatisPlusInterceptor mybatisPlusInterceptor() {
//        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
//        // 数据权限-新
//        DataScopeInnerInterceptor1 dataScopeInnerInterceptor = new DataScopeInnerInterceptor1();
//        dataScopeInnerInterceptor.setDataScopeHandle(dataScopeHandle());
//        interceptor.addInnerInterceptor(dataScopeInnerInterceptor);
//        // 分页支持
//        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
//        return interceptor;
//    }
//
//
//
//    /**
//     * 扩展 mybatis-plus baseMapper 支持数据权限
//     * @return
//     */
//    @Bean
//    @ConditionalOnBean(DataScopeHandle.class)
//    public DataScopeSqlInjector dataScopeSqlInjector() {
//        return new DataScopeSqlInjector();
//    }
//
//}